#pragma once
#include "DeviceBase.h"
#include <string>

namespace RobotPlant { namespace RobotProxy{
	using namespace std;
	using namespace boost::join;
	using namespace RobotPlant::Common;

	RP_ROBOTPROXY_TEMPLATE template class RP_ROBOTPROXY_API vector<DeviceBase*>;

	/*
	Represents a remote robot.
	*/
	class RP_ROBOTPROXY_API RobotInstance: public joint
	{
		friend class DeviceBase;
		friend class AnalogSensorDevice;
		friend class ArmDevice;
		friend class BatteryDevice;
		friend class CameraDevice;
		friend class ContactSensorDevice;
		friend class DiffDriveDevice;
		friend class EncoderDevice;
		friend class MotorDevice;
		friend class SickLRFDevice;
		friend class SonarDevice;
		friend class StreamDevice;

	protected:
		/*
		The robot instance mutex.
		*/
		boost::mutex _mutex;

		/*
		The devices vector
		*/
		vector<boost::shared_ptr<DeviceBase>> _devices;

		/*
		The robot device interface soap server address.
		*/
		string _soapServer;

	public:
		/*
		Constructor
		*/
		RobotInstance(string soapServer, joint::spawn_type e=0);

		/*
		Destructor
		*/
		~RobotInstance();

		/*
		Get soap server address.
		*/
		string GetSoapServer();

		/*
		Gets the robot instance by the specified index.
		*/
		boost::shared_ptr<DeviceBase> GetDevice(int index);

		/*
		Gets the robot instances' count.
		*/
		int GetDeviceCount();

	protected:
	};
}}
